package cn.pda.serialport;

import java.io.FileDescriptor;
import java.io.IOException;

public class SerialPort
{
  private static final String TAG = "SerialPort";
  public static int TNCOM_EVENPARITY = 0;
  public static int TNCOM_ODDPARITY = 1;
  FileDescriptor mFd;
  private boolean trig_on = false;
  
  static
  {
    System.loadLibrary("devapi");
    System.loadLibrary("irdaSerialPort");
  }
  
  public SerialPort(int paramInt1, int paramInt2, int paramInt3)
    throws SecurityException, IOException
  {
    this.mFd = open(paramInt1, paramInt2, 0);
  }
  
  private static native FileDescriptor open(int paramInt1, int paramInt2);
  
  public static native FileDescriptor open(int paramInt1, int paramInt2, int paramInt3);
  
  public static native void power3v3off();
  
  public static native void power3v3on();
  
  public static native void rfidPoweroff();
  
  public static native void rfidPoweron();
  
  public static native void setGPIOhigh(int paramInt);
  
  public static native void setGPIOlow(int paramInt);
  
  public static void zigbee_poweron() {}
  
  public static native void zigbeepoweroff();
  
  public static native void zigbeepoweron();
  
  public boolean IsDevOK()
  {
    return this.mFd != null;
  }
  
  public native void close(int paramInt);
  
  public native void irdapoweroff();
  
  public native void irdapoweron();
  
  public void psam_poweroff()
  {
    psampoweroff();
  }
  
  public void psam_poweron()
  {
    psampoweron();
  }
  
  public native void psampoweroff();
  
  public native void psampoweron();
  
  public void scaner_poweroff()
  {
    scanerpoweroff();
  }
  
  public void scaner_poweron()
  {
    scanerpoweron();
    scaner_trigoff();
  }
  
  public boolean scaner_trig_stat()
  {
    return this.trig_on;
  }
  
  public void scaner_trigoff()
  {
    scanertrigeroff();
    this.trig_on = false;
  }
  
  public void scaner_trigon()
  {
    scanertrigeron();
    this.trig_on = true;
  }
  
  public native void scanerpoweroff();
  
  public native void scanerpoweron();
  
  public native void scanertrigeroff();
  
  public native void scanertrigeron();
  
  public native void setPortParity(int paramInt);
  
  public void setPortparity(int paramInt)
  {
    setPortParity(paramInt);
  }
  
  public native void test(byte[] paramArrayOfByte);
  
  public native void usbOTGpowerOff();
  
  public native void usbOTGpowerOn();
}
